from waftools.pebble_test import clar


def build(ctx):

    def test_timeline_service(test_name, defines=None):
        clar(ctx,
             test_name=test_name,
             defines=defines,
             sources_ant_glob=(
                 "src/fw/services/normal/blob_db/pin_db.c "
                 "src/fw/services/normal/blob_db/sync_util.c "
                 "src/fw/services/normal/blob_db/timeline_item_storage.c "
                 "src/fw/services/normal/timeline/attribute.c "
                 "src/fw/services/normal/timeline/attribute_group.c "
                 "src/fw/services/normal/timeline/attributes_actions.c "
                 "src/fw/services/normal/timeline/item.c "
                 "src/fw/services/normal/timeline/timeline.c "
                 "src/fw/util/crc8.c "
                 "src/fw/util/time/mktime.c "
                 "src/fw/util/time/time.c "
                 "tests/fakes/fake_rtc.c "
                 "tests/fakes/fake_settings_file.c "
             ),
             test_sources_ant_glob="test_timeline.c",
             override_includes=['dummy_board'])

    test_timeline_service(test_name='test_timeline')

    clar(ctx,
         sources_ant_glob=(
             "src/fw/services/normal/blob_db/pin_db.c "
             "src/fw/services/normal/blob_db/sync_util.c "
             "src/fw/services/normal/blob_db/timeline_item_storage.c "
             "src/fw/services/normal/blob_db/util.c "
             "src/fw/services/normal/timeline/attribute.c "
             "src/fw/services/normal/timeline/attribute_group.c "
             "src/fw/services/normal/timeline/attributes_actions.c "
             "src/fw/services/normal/timeline/item.c "
             "src/fw/util/crc8.c "
             "src/fw/util/time/mktime.c "
             "src/fw/util/time/time.c "
             "tests/fakes/fake_blobdb.c "
             "tests/fakes/fake_rtc.c "
             "tests/fakes/fake_session.c "
             "tests/fakes/fake_settings_file.c "
             "tests/fakes/ram_storage.c "
             "tests/fakes/test_db.c "
         ),
         test_sources_ant_glob="test_pin_db.c")

    clar(ctx,
        sources_ant_glob = \
            " src/fw/services/normal/blob_db/util.c" \
            " src/fw/services/normal/blob_db/sync.c" \
            " tests/fakes/ram_storage.c" \
            " tests/fakes/test_db.c" \
            " tests/fakes/fake_blobdb.c",
        test_sources_ant_glob = "test_blob_db_sync.c")

    clar(ctx,
        sources_ant_glob = \
            " src/fw/services/normal/blob_db/api.c" \
            " src/fw/services/normal/blob_db/endpoint.c " \
            " src/fw/services/normal/blob_db/endpoint_private.c " \
            " src/fw/services/normal/blob_db/util.c" \
            " tests/fakes/fake_session.c",
        test_sources_ant_glob = "test_blob_db_endpoint.c")

    clar(ctx,
        sources_ant_glob = \
            " src/fw/services/normal/blob_db/api.c" \
            " src/fw/services/normal/blob_db/endpoint2.c " \
            " src/fw/services/normal/blob_db/endpoint_private.c " \
            " src/fw/services/normal/blob_db/util.c",
        test_sources_ant_glob = "test_blob_db2_endpoint.c")

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_spi_flash.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/services/normal/settings/settings_file.c" \
            " src/fw/services/normal/settings/settings_raw_iter.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/blob_db/app_db.c",
        test_sources_ant_glob = "test_app_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
         sources_ant_glob = \
             " src/fw/services/normal/blob_db/app_glance_db.c" \
             " src/fw/services/normal/timeline/attribute.c" \
             " src/fw/util/crc8.c" \
             " tests/fakes/fake_rtc.c" \
             " tests/fakes/fake_settings_file.c" \
             " tests/fakes/fake_events.c" \
             "",
         test_sources_ant_glob = "test_app_glance_db.c",
         override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_spi_flash.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/services/normal/settings/settings_file.c" \
            " src/fw/services/normal/settings/settings_raw_iter.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/blob_db/contacts_db.c",
        test_sources_ant_glob = "test_contacts_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_spi_flash.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/services/normal/settings/settings_file.c" \
            " src/fw/services/normal/settings/settings_raw_iter.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/blob_db/watch_app_prefs_db.c",
        test_sources_ant_glob = "test_watch_app_prefs_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " src/fw/util/time/time.c" \
            " src/fw/services/normal/blob_db/timeline_item_storage.c" \
            " tests/fakes/fake_settings_file.c" \
            " src/fw/services/normal/blob_db/reminder_db.c" \
            " src/fw/services/normal/blob_db/sync_util.c" \
            " src/fw/services/normal/timeline/attribute.c" \
            " src/fw/services/normal/timeline/attributes_actions.c" \
            " src/fw/services/normal/timeline/attribute_group.c" \
            " src/fw/services/normal/timeline/item.c",
        test_sources_ant_glob = "test_reminder_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_spi_flash.c" \
            " tests/fakes/fake_kernel_services_notifications.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/util/time/time.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/notifications/notification_storage.c" \
            " src/fw/services/normal/timeline/attribute.c" \
            " src/fw/services/normal/timeline/item.c" \
            " src/fw/services/normal/timeline/attributes_actions.c" \
            " src/fw/services/normal/timeline/attribute_group.c" \
            " src/fw/services/normal/blob_db/notif_db.c",
        test_sources_ant_glob = "test_notif_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/pstring.c" \
            " src/fw/util/time/time.c" \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_rtc.c" \
            " tests/fakes/fake_spi_flash.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/services/normal/settings/settings_file.c" \
            " src/fw/services/normal/settings/settings_raw_iter.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/blob_db/weather_db.c" \
            " tests/fw/services/blob_db/weather_data_shared.c",
        test_sources_ant_glob = "test_weather_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " src/fw/util/time/time.c" \
            " src/fw/flash_region/filesystem_regions.c" \
            " src/fw/flash_region/flash_region.c" \
            " src/fw/services/normal/filesystem/flash_translation.c" \
            " src/fw/services/normal/filesystem/pfs.c" \
            " src/fw/services/normal/settings/settings_file.c" \
            " src/fw/services/normal/settings/settings_raw_iter.c" \
            " src/fw/services/normal/blob_db/prefs_db.c" \
            " src/fw/shell/normal/prefs.c" \
            " src/fw/util/crc8.c" \
            " src/fw/util/legacy_checksum.c" \
            " tests/fakes/fake_spi_flash.c" \
            " tests/fakes/fake_rtc.c",
        test_sources_ant_glob = "test_prefs_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/libutil/uuid.c" \
            " src/fw/util/rand/rand.c" \
            " third_party/tinymt/TinyMT/tinymt/tinymt32.c" \
            " tests/fakes/fake_rtc.c" \
            " tests/fakes/fake_settings_file.c" \
            " src/fw/util/time/time.c" \
            " src/fw/services/normal/timeline/attribute.c" \
            " src/fw/services/normal/timeline/item.c" \
            " src/fw/services/normal/timeline/attributes_actions.c" \
            " src/fw/services/normal/timeline/attribute_group.c"
            " src/fw/services/normal/blob_db/sync_util.c" \
            " src/fw/services/normal/blob_db/ios_notif_pref_db.c" ,
        test_sources_ant_glob = "test_ios_notif_pref_db.c",
        override_includes=['dummy_board'])

    clar(ctx,
        sources_ant_glob = \
            " src/fw/util/crc8.c" \
            " src/fw/util/time/time.c" \
            " tests/fakes/fake_settings_file.c" \
            " src/fw/services/normal/blob_db/health_db.c" ,
        test_sources_ant_glob = "test_health_db.c",
        override_includes=['dummy_board'])


# vim:filetype=python
